package com.sky.controller.admin;

import com.sky.dto.SetmealDTO;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.result.PageResult;
import com.sky.result.Result;
import com.sky.service.impl.SetmealServicelmpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/admin/setmeal")
@Slf4j
@Api(tags="套餐管理")
public class SetmealController {
    @Autowired
    private SetmealServicelmpl setmealServicelmpl;

    /**
     * 修改套餐
     * @param setmealDTO
     * @return
     */
    @PutMapping()
    @ApiOperation("修改套餐")
    @CacheEvict(cacheNames = "update",allEntries = true)
    public Result update(SetmealDTO setmealDTO){

        return Result.success();
    }

    /**
     * 分页查询
     * @param setmealPageQueryDTO
     * @return
     */
    @GetMapping("/page")
    @ApiOperation("分页查询")
    public Result<PageResult> pageSelect(SetmealPageQueryDTO setmealPageQueryDTO){
        PageResult pageResult=setmealServicelmpl.pageSelect(setmealPageQueryDTO);
        return Result.success(pageResult);
    }
}
